﻿@using SCMS.Resources
@model SCMS.UI.Models.DailyFleetMgt
@{AjaxOptions ajaxOpts = new AjaxOptions
  {
      UpdateTargetId = "fleetDiv",
      LoadingElementId = "loading",
      HttpMethod = "Post",
      Url = Url.Action(@ViewBag.Action),
      OnSuccess = string.Format("usermsg('{0}');CloseDialog(); initPostFundsView(1);", Resources_frank.Global_String_ProcessCompleted),
      OnFailure = "javascript:errormsg()"
  };}
<script src="@Url.Content("~/Scripts/js/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Ajax.BeginForm(null, null, ajaxOpts, new { @class = "form", @id = "frmDFleet" }))
{
    @Html.ValidationSummary(true)
    <br />
    @Html.HiddenFor(model => model.EntityDailFM.Id)
    @Html.HiddenFor(model => model.EntityDailFM.FleetId)
    @Html.HiddenFor(model => model.EntityDailFM.IssueDate)
    <table width="98%" align="center" cellpadding="0">
        <tr class="gridheader2">
            <td align="center">
                @Resources_frank.Global_String_Date
            </td>
            <td align="center">
                @Resources_frank.FleetManager_LoadFleetDetails_StartMileage
            </td>
        </tr>
        <tr>
            <td align="center" valign="top">
                @Html.EditorFor(x => x.EntityDailFM.Date)
                @Html.ValidationMessageFor(x => x.EntityDailFM.Date, Resources_frank.Global_String_Required)
            </td>
            <td align="center" valign="top">
                <input type="hidden" value="@ViewBag.LastMilleage" id="lastmilg" />
                <input type="hidden" value="@ViewBag.CurrentStartMilleage" id="currentmilg" />
                @Html.TextBoxFor(x => x.EntityDailFM.StartMilleage, new { id = "txtstartMilleage", @autocomplete = "off", onblur = "javascript:ValidateFirstMilleage();" })
                @Html.ValidationMessageFor(x => x.EntityDailFM.StartMilleage, Resources_frank.Global_String_Required)
            </td>
        </tr>
        <tr class="gridheader2">
            <td align="center">
                @Resources_frank.FleetManager_LoadFleetDetails_EndMileage
            </td>
            <td align="center">
                @Resources_frank.FleetManager_LoadFleetDetails_DistanceCovered
            </td>
        </tr>
        <tr>
            <td align="center" valign="top">
                @Html.TextBoxFor(x => x.EntityDailFM.EndMilleage, new { id = "txtendMilleage", onblur = "javascript:ComputeTotalDistance()", @autocomplete = "off" })
                @Html.ValidationMessageFor(x => x.EntityDailFM.EndMilleage, Resources_frank.Global_String_Required)
            </td>
            <td align="center" valign="top">
                @Html.TextBoxFor(x => x.EntityDailFM.DistancedCovered, new { id = "txttotaldistance", @readonly = true })
                @Html.ValidationMessageFor(x => x.EntityDailFM.DistancedCovered, Resources_frank.Global_String_Required)
            </td>
        </tr>
        <tr class="gridheader2">
            <td align="center">
                @Resources_frank.FleetManager_LoadNewDailyFleet_TotalFuelInput
            </td>
            <td align="center">
                @Resources_frank.FleetManager_LoadFleetDetails_AnyMajorIncidence
            </td>
        </tr>
        <tr>
            <td align="center" valign="top">
                @Html.EditorFor(x => x.EntityDailFM.TotalFuelConsumed)
                @Html.ValidationMessageFor(x => x.EntityDailFM.TotalFuelConsumed, Resources_frank.Global_String_Required)
            </td>
            <td align="center" valign="top">
                @Html.DropDownListFor(x => x.EntityDailFM.IncidenceId, Model.Incidences, Resources_frank.Global_String_PleaseSelect)
                @Html.ValidationMessageFor(x => x.EntityDailFM.IncidenceId, Resources_frank.Global_String_Required)
            </td>
        </tr>
    </table>
    <hr />
               
    <center>
        <input type="submit" class="btn green" value="  @Resources_frank.Global_String_Save  " /></center>
}
